"""
登录页面
"""

from po.base_page import BasePage
from selenium.webdriver.common.by import By


class LoginPage(BasePage):

    def login_with_username_password(self, username, password):
        """
        用户名密码
        :param username:
        :param password:
        :return:
        """

        # 用户名
        name_input = self.driver.find_element(By.CSS_SELECTOR, 'input[type="text"]')
        name_input.clear()
        name_input.send_keys(username)

        # 密码
        password_input = self.driver.find_element(By.CSS_SELECTOR, 'input[type="password"]')
        password_input.clear()
        password_input.send_keys(password)

        # 点击登录
        self.driver.find_element(By.CSS_SELECTOR, 'button[type="primary"]').click()
